package cn.codepandas.unifiedresponse.model;

/**
 * 四种基础的结果码
 *
 * @author Amaris
 * @since 1.0.0
 */
public enum ResultCode implements IResultCode{

    /**
     * 正常
     */
    SUCCESS(200, "00000", "一切正常", "一切正常，请继续操作！"),

    /**
     * 客户端错误
     */
    CLIENT_ERROR(400, "A0001", "客户端发生错误", "客户端发生错误啦！"),

    /**
     * 服务端错误
     */
    SERVER_ERROR(500, "B0001", "服务端发生错误", "服务器发生错误啦！"),

    /**
     * 第三方服务调用错误
     */
    SERVICE_ERROR(500, "C0001", "第三方服务发生错误", "第三方服务发生错误啦！");

    private final Integer status;
    private final String code;
    private final String message;
    private final String tip;

    ResultCode(Integer status, String code, String message, String tip) {
        this.status = status;
        this.code = code;
        this.message = message;
        this.tip = tip;
    }

    @Override
    public String toString() {
        return "ResultCode{" +
                "status=" + status +
                ", code='" + code + '\'' +
                ", message='" + message + '\'' +
                ", tip='" + tip + '\'' +
                '}';
    }

    @Override
    public Integer getStatus() {
        return status;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getTip() {
        return tip;
    }

}